/******************
分数明细
* */
<template>
    <el-dialog
    :title="dialogTitle"
    :close-on-click-modal="false"
    :visible.sync="visible"
    width="60%"
    top="8vh"
    @close="closeDialog()"
  >

        <div style="margin: 0px 10px 10px;padding:15px;box-shadow: 5px 5px 10px #e3e3ea, -5px -5px 10px #ffffff">
          <el-form
            ref="dataForm"
            :model="dataForm"
            label-position="right"
            label-width="120px"
          >
             <el-row>
                  <el-col :span="8" v-if="tabType == '0'">
                    <el-form-item label="员工编号">
                      <span>{{dataForm.ygbm}}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="部门">
                      <span>{{dataForm.deptName}}</span>
                    </el-form-item>
                  </el-col>
                 <el-col :span="8">
                   <el-form-item label="类型">
                     <span>{{dataForm.lx|transStateLx}}</span>
                   </el-form-item>
                 </el-col>
                <el-col :span="8"  v-if="tabType == '0'">
                  <el-form-item label="姓名">
                    <span>{{dataForm.ygname}}</span>
                  </el-form-item>
                </el-col>
                  <el-col :span="8">
                    <el-form-item label="岗位" v-if="tabType == '0'">
                      <span>{{dataForm.gwmc}}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="总分">
                      <span>{{dataForm.sumScore}}</span>
                    </el-form-item>
                  </el-col>
              </el-row>
          </el-form>
          <div style="height: 10px; border-top: 1px solid #b0bde2"></div>
          <el-table
            style="margin-top:20px"
            :data="dataList"
            border
            stripe
            v-loading="loading"
            header-align="center"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="index"  width="55" label="序号"></el-table-column>
           <!-- <el-table-column prop="ywbh" align="center" label="业务编号"></el-table-column>-->
            <el-table-column prop="ywmc" align="center" label="业务名称"></el-table-column>
            <el-table-column prop="ywdate" align="center" label="业务截止时间"></el-table-column>
            <el-table-column prop="score" align="center" label="分数"></el-table-column>
          </el-table>
         <!-- <span slot="footer" class="dialog-footer">
            <el-button type="primary" plain @click="closeDialog()">返回</el-button>
          </span>-->
        </div>

  </el-dialog>
</template>

<script>
import {getScoreById,transStateLx} from "@/api/statisticsanalysis/fractionGet";
export default {
  data() {
    return {
      dataList: [], //指标数组
      dialogTitle: "分数明细", //弹窗标题
      visible: false, //最外层弹窗显隐
      dataForm: {},
      loading:false,
      tabType:'0'
    };
  },
  components: {
  },
  filters:{
      transStateLx
  },
  watch: {

  },
  methods: {
    // 选中指标
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 初始化
    init(data,tabType) {
         this.visible = true;
         this.dataForm = data;
         this.tabType = tabType ;
         this.getScoreMx(data.id,data.lx) ;
    },
    // 关闭
    closeDialog() {
      this.visible = false;
      this.$emit("closeDialog");
    },
    //获取个人的所有分数
      getScoreMx(id,lx){
        this.loading = true ;

        let url = '' ;
        switch (lx) {
            case 'ht' :
                url = `/appr-event/pfhzfstqhetong/getHetongScoreList/${id}`;
                break ;
            case 'rckh' :
                url = `/appr-event/pfhzfstqrckh/getRckhScoreList/${id}`;
                break ;
            case 'zdrw' :
                url = `/appr-event/pfhzfstqzdrw/getDetail/${id}`;
                break ;
            case 'gzrws' :
                url = `/appr-event/pfhzfstqgzrws/getDetail/${id}`;
                break ;
            default:
                break ;
        }


         getScoreById(id,url).then(r => {
             if (r.data.code == 0) {
                this.loading = false ;
                 this.dataList = r.data.data ;
             }
         }) .catch(err => {
             this.$message.error(r.data.msg);
         });;
    },
  }
};
</script>

<style lang="scss" scoped>
/deep/.el-form-item--small .el-form-item__label{font-weight: bold!important;}
</style>
